Skip to content

feat(copilot): support --integration-options="--skills" for skills-based scaffolding#2324

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/add-integration-options-skills
Draft

feat(copilot): support --integration-options="--skills" for skills-based scaffolding#2324
Copilot wants to merge 6 commits intomainfrom
copilot/add-integration-options-skills

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

Adds a --skills flag to the Copilot integration enabling speckit-<name>/SKILL.md scaffolding under .github/skills/ as an alternative to the default .agent.md + .prompt.md + settings merge layout. The two modes are mutually exclusive.

# Default: .agent.md agents + .prompt.md companions + settings merge
specify init my-project --integration copilot

# Skills mode: speckit-<name>/SKILL.md under .github/skills/
specify init my-project --integration copilot --integration-options="--skills"

Implementation

  • Composition over inheritance: _CopilotSkillsHelper(SkillsIntegration) with .github/skills/ config is used as a delegate — CopilotIntegration stays on IntegrationBase
  • setup() branches into _setup_default() and _setup_skills() based on parsed_options["skills"]
  • post_process_skill_content() injects mode: speckit.<stem> into SKILL.md frontmatter (Copilot-specific field, analogous to Claude's user-invocable/disable-model-invocation)
  • build_command_invocation() returns /speckit-<stem> in skills mode, bare args in default mode
  • dispatch_command() detects skills mode from _skills_mode flag or .github/skills/ presence on disk

CLI plumbing

  • init now parses --integration-options via _parse_integration_options() and merges into integration_parsed_options (previously only integration_install/integration_switch did this)
  • ai_skills in init-options.json is set when _skills_mode is active, so downstream tools (presets, extensions) emit SKILL.md overrides correctly

Tests

22 new tests in TestCopilotSkillsMode covering: directory structure, no .prompt.md/.vscode/settings.json in skills mode, frontmatter structure with mode: field, post_process_skill_content() idempotency, manifest tracking, install/uninstall roundtrip, build_command_invocation() in both modes, full CLI integration, and complete file inventory. All 15 existing default-mode tests unchanged.

Copilot AI requested review from Copilot and removed request for Copilot April 22, 2026 22:48
Copilot AI linked an issue Apr 22, 2026 that may be closed by this pull request
8 tasks
Add --skills integration option to CopilotIntegration that scaffolds
commands as speckit-<name>/SKILL.md under .github/skills/ instead of
the default .agent.md + .prompt.md layout.

- Add options() with --skills flag (default=False)
- Branch setup() between default and skills modes
- Add post_process_skill_content() for Copilot-specific mode: field
- Adjust build_command_invocation() for skills mode (/speckit-<stem>)
- Update dispatch_command() with skills mode detection
- Parse --integration-options during init command
- Add 22 new skills-mode tests
- All 15 existing default-mode tests continue to pass

Agent-Logs-Url: https://github.com/github/spec-kit/sessions/a4903fab-64ff-46c3-8eb8-a47f495a70c0

Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 22, 2026 22:58
Copilot AI requested review from Copilot and removed request for Copilot April 22, 2026 23:00
Comment thread src/specify_cli/integrations/copilot/__init__.py Fixed
Copilot AI changed the title [WIP] Add --skills flag for skills-based scaffolding in Copilot integration feat(copilot): support --integration-options="--skills" for skills-based scaffolding Apr 22, 2026
Copilot AI requested a review from mnriem April 22, 2026 23:02
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 22, 2026 23:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Copilot integration “skills mode” (--integration-options="--skills") that scaffolds speckit-<name>/SKILL.md under .github/skills/ (instead of .agent.md + .prompt.md + VS Code settings merge), along with CLI plumbing and tests.

Changes:

  • Introduces --skills integration option for Copilot and branches setup() into default vs skills scaffolding.
  • Extends init to parse and forward --integration-options into integration parsed_options, and persists ai_skills when an integration is operating in skills mode.
  • Adds a new test suite covering Copilot skills-mode scaffolding, post-processing, install/uninstall, and CLI integration.
Show a summary per file
File Description
tests/integrations/test_integration_copilot.py Adds comprehensive tests for Copilot --skills mode behavior and CLI wiring.
src/specify_cli/integrations/copilot/init.py Implements Copilot skills-mode scaffolding via a delegate SkillsIntegration helper and adds SKILL.md post-processing + dispatch changes.
src/specify_cli/init.py Ensures init parses --integration-options and persists ai_skills for integrations operating in skills mode.
AGENTS.md Documents Copilot’s new skills mode and how to enable it.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/4 changed files
  • Comments generated: 4

Comment thread src/specify_cli/integrations/copilot/__init__.py Outdated
Comment thread src/specify_cli/integrations/copilot/__init__.py Outdated
Comment thread src/specify_cli/__init__.py
Comment thread src/specify_cli/integrations/copilot/__init__.py Outdated
- Reset _skills_mode at start of setup() to prevent singleton state leak
- Tighten skills auto-detection to require speckit-*/SKILL.md (not any
  non-empty .github/skills/ directory)
- Add copilot_skill_mode to init next-steps so skills mode renders
  /speckit-plan instead of /speckit.plan
- Fix docstring quoting to match actual unquoted output
- Add 4 tests covering singleton reset, auto-detection false positive,
  speckit layout detection, and next-steps skill syntax
- Fix skipped test_invalid_metadata_error_returns_unknown by simulating
  InvalidMetadataError on Python versions that lack it
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 5/5 changed files
  • Comments generated: 2

Comment thread src/specify_cli/integrations/copilot/__init__.py Outdated
Comment thread tests/integrations/test_integration_copilot.py
build_command_invocation() reads self._skills_mode which stays False
when skills mode is only auto-detected from the project layout. Inline
the /speckit-<stem> prompt construction so dispatch_command() sends the
correct prompt regardless of how skills mode was detected.

Also strengthen test_dispatch_detects_speckit_skills_layout to assert
the -p prompt contains /speckit-plan and the user args.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 5/5 changed files
  • Comments generated: 1

Comment on lines +313 to +317
parsed_options = parsed_options or {}
self._skills_mode = bool(parsed_options.get("skills"))
if self._skills_mode:
return self._setup_skills(project_root, manifest, parsed_options, **opts)
return self._setup_default(project_root, manifest, parsed_options, **opts)
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setup() currently decides skills vs default mode solely from parsed_options.get("skills"). If a project is already in skills layout (e.g. .github/skills/speckit-*/SKILL.md exists) and the user reruns integration install copilot / setup() without --integration-options "--skills", this will scaffold the default .github/agents + .github/prompts artifacts as well, contradicting the “modes are mutually exclusive” contract and leaving the project in a mixed state. Consider treating skills as tri-state (explicitly True/False vs unspecified): when unspecified, auto-detect existing layout and stick to it (or raise a clear error if both layouts are present), and when explicitly set, error out if conflicting artifacts from the other mode already exist unless the user uninstalls/cleans first.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

copilot: Support --integration-options="--skills" for skills-based scaffolding

3 participants